<template>
  <div class="wrapper">
    <van-list
      class="list"
      v-model="loading"
      :finished="finished"
      finished-text="没有更多了"
      @load="onLoad"
    >
      <div class="box-wrap">
        <div class="box" v-for="i in list" :key="i" @click="$router.push('/selfDrivingExperience')">
          <div class="img-wrap">
            <img
              src="https://imgoss.wkzuche.com/order_comment/2021/1109/155513b3-c20c-4734-8a9e-822a33c7e7a6.jpg?x-oss-process=image/resize,m_lfit,w_1000"
              alt=""
            />
          </div>
          <div class="position">
            <span class="address">深圳</span>
            <i class="iconfont icon-dian"></i>
            <span class="score">5.0分</span>
          </div>
          <div class="text">
            <div class="text-wrap">
              服务态度完美，而且车是新车，开起来真的没的说，完美，完美，完美，
              重要的事情说三遍，特别推荐大家来这边租车,什么都很好!
            </div>
          </div>
          <div class="phone">
            <div class="user_pic">
              <img src="../../../assets/image/icon.png" alt="" />
            </div>
            <div class="phone-number">198****1640</div>
            <div class="clickGood">
              <i class="iconfont icon-dianzan"></i>
              <span class="number">66</span>
            </div>
          </div>
        </div>
      </div>
    </van-list>
  </div>
</template>

<script>

export default {
  data() {
    return {
      list: [],
      loading: false,
      finished: false,
    };
  },
  methods: {
    onLoad() {
      // 异步更新数据
      // setTimeout 仅做示例，真实场景中一般为 ajax 请求
      setTimeout(() => {
        for (let i = 0; i < 10; i++) {
          this.list.push(this.list.length + 1);
        }

        // 加载状态结束
        this.loading = false;

        // 数据全部加载完成
        if (this.list.length >= 40) {
          this.finished = true;
        }
      }, 1000);
    },
  },
  
};
</script>

<style lang="scss" scoped>
.wrapper {
  .list {
    .box-wrap {
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
    }
    .box {
      width: 172px;
      height: 256px;
      background: white;
      position: relative;
      margin: 10px 0;
      border-radius: 10px;
      .img-wrap {
        width: 162px;
        height: 172px;
        overflow: hidden;
        margin: 0 auto;
        border-radius: 5px;
        margin-top: 5px;
        img {
          width: 100%;
          height: 100%;
        }
      }
    }
    .position {
      position: absolute;
      top: 152px;
      left: 20px;
      font-size: 12px;
      background: rgb(29, 28, 28);
      color: rgb(218, 217, 217);
      height: 18px;
      line-height: 18px;
      text-align: center;
      border-radius: 9px;
      padding: 0 8px;
    }
    .text {
      width: 100%;
      height: 32px;
      font-size: 13px;
      padding: 10px 5px 5px;
      .text-wrap {
        font-weight: 700;
        text-overflow: -o-ellipsis-lastline;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
      }
    }
    .phone {
      display: flex;
      justify-content: start;
      align-items: center;
      padding: 0 2px;
      margin-top: 5px;
      .user_pic {
        width: 18px;
        height: 18px;
        border-radius: 9px;
        overflow: hidden;
        img {
          width: 100%;
          height: 100%;
        }
      }
      .phone-number {
        font-size: 10px;
        color: #919499;
        line-height: 18px;
        text-align: center;
        padding-left: 5px;
      }
      .clickGood {
        margin-left: 45px;
        font-size: 10px;
        .number {
          font-size: 13px;
          margin-left: 2px;
        }
      }
    }
  }
}
</style>